<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /*
            1.变化的数据用参数传递
            2.如果有需要返回的数据，用return返回结果
        */

        function contetn(startNum,endNum)
        {
            var total=0;
            for(var i=startNum;i<=endNum;i++)
            {
                total+=i
            }
            return total;
        }
        var all1=contetn(1,100)  //调用函数1
        console.log(all1);
        var all2=contetn(1,5)     //调用函数2
        console.log(all2);
        var all3=contetn(10,20)    //调用函数3
        console.log(all3);
        
    </script>
</head>
<body>
    
</body>
</html>